import Vue from 'vue'
import App from './App.vue'

//注册三级联动组件为全局组件
import TypeNav from '@/components/TypeNav'
//注册轮播图组件为全局组件
import Carousel from '@/components/Carousel'
//注册分页组件为全局组件
import Pagination from '@/components/Pagination'
import { Button,MessageBox} from 'element-ui';
//引入vue-lazyload
import VueLazyload from 'vue-lazyload'
import ys from '@/assets/lazy.png'
Vue.use(VueLazyload,{
  loading:ys
})
//第一个参数是组件名字，第二个参数是注册的组件
Vue.component(TypeNav.name, TypeNav)
Vue.component(Carousel.name,Carousel)
Vue.component(Pagination.name,Pagination)
//注册全局组件
Vue.component(Button.name,Button);
//ElementUI注册组件的时候，还有一种写法，挂在原型上
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;
//引入路由
import router from '@/router'
//引入仓库
import store from '@/store'
//引入mockjs
import "@/mock/mockServe"
//引入swiper的样式
import "swiper/css/swiper.css"
//练习不使用vuex,统一接收api文件夹里面全部请求函数
import *as API from '@/api'
//引入表单校验
import '@/plugins/validate'


Vue.config.productionTip = false

//测试
//import { reqCategoryList } from './api'
//reqCategoryList()
new Vue({
  render: (h) => h(App),
  beforeCreate(){
    Vue.prototype.$bus=this
    Vue.prototype.$API=API
  },
  router,
  store
}).$mount('#app')
